/**
 * @file: user.ts
 * @author: Lengxx
 * @date: 2024-05-16
 */

import { Column, CreateDateColumn, UpdateDateColumn, Entity, PrimaryGeneratedColumn, ManyToOne } from 'typeorm';
import { StoreManageEntity } from '../../storeManage/entity/storeManage';

@Entity("User")
export class User {
  /** 组建自增列 */
  @PrimaryGeneratedColumn()
  id: number;

  /** 用户名 */
  @Column()
  username: string;

  /** 密码 */
  @Column()
  password: string;

  /** 头像 */
  @Column('longtext')
  avatar: string;

  @Column({ comment: '昵称' })
  nickname?: string;

  @Column({ comment: '联系方式' })
  phone?: string;

  @Column({ comment: '角色' })
  role?: string;

  @ManyToOne(type => StoreManageEntity, store => store.users)
  store?: StoreManageEntity

  @CreateDateColumn({ comment: '创建时间' })
  create_date: Date;

  @UpdateDateColumn({ comment: '更新时间' })
  update_date: Date;

}

export default User